<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>添加车辆信息</title>
		<link rel="stylesheet" type="text/css" href="../css/Reimbursement.css" />
		<link type="text/css" href="../css/jquery-ui-1.8.17.custom.css" rel="stylesheet" />
		<link type="text/css" href="../css/jquery-ui-timepicker-addon.css" rel="stylesheet" />
		<script type="text/javascript" src="../js/jquery.min.js" charset="utf-8"></script>
		<script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
		<script type="text/javascript" src="../js/jquery-ui-1.8.17.custom.min.js"></script>
		<script type="text/javascript" src="../js/jquery-ui-timepicker-addon.js"></script>
		<script type="text/javascript" src="../js/jquery-ui-timepicker-zh-CN.js"></script>
		<meta name="viewport" content=" height=device-height,
			          width=device-width,
			          initial-scale=1.0,
			          minimum-scale=1.0,
			          maximum-scale=1.0,
			          user-scalable=no" />
		<script type="text/javascript">
			var ip = localStorage.getItem("ip");
			var token = localStorage.getItem("token");
			var userId = localStorage.getItem("userId");
			var userName = localStorage.getItem("name");
			$(function() {
				var initializationTime = (new Date()).getTime();
				var now = new Date();
				var year = now.getFullYear();
				var month = now.getMonth() + 1;
				var day = now.getDate();
				var hours = now.getHours();
				var minutes = now.getMinutes();
				var seconds = now.getSeconds();
				var data = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
				document.getElementById('ui_timepicker').value = data;
				$("#ui_timepicker").datetimepicker({
					showSecond: true,
					timeFormat: 'hh:mm:ss',
					stepHour: 1,
					stepMinute: 1,
					stepSecond: 1
				})
			})

			var isok = true;

			function submitFun() {
				var carNum = document.getElementById('carNum').value;
				if(carNum == '') {
					alert("车牌号不能为空");
					return false;
					isok = false;
				}
				var carName = document.getElementById('carName').value;
				if(reason == '') {
					alert("车辆名称不能为空");
					return false;
					isok = false;
				}
				var ui_timepicker = document.getElementById('ui_timepicker').value;
				if(ui_timepicker == '') {
					alert("申请时间不能为空");
					return false;
					isok = false;
				}
			}

			function start() {
					var url = ip + "car/addCar";
					var formData = new FormData($('#dataForm')[0]);
					formData.append("createId", userId);
					formData.append("token", token);
					$.ajax({
						cache: false,
						type: "POST",
						url: url,
						data: formData,
						processData: false,
						contentType: false,
						error: function(request) {},
						success: function(data) {
							var a = JSON.parse(data)
							alert(a.msg);
							if("成功" == a.msg) {
								window.location.href = 'vehicleManageList.html';
							}
						}
					});
			}
		</script>
	</head>

	<body style="background: #d9d9d9;">
		<form action="#" method="post" id="dataForm" enctype="multipart/form-data">
			<div style=" background: white; width: 90%; margin-left: 5%;margin-top: 10%; box-shadow:1px 2px 1px 1px #aaa;-webkit-border-radius: 10px;">
				<label></label><br />
				<label></label><br />
				<label>车&nbsp;&nbsp;牌&nbsp;&nbsp;号:</label>
				<input type="text" id="carNum" class="txt" name="carNum" /><br />
				<label>车辆名称:</label>
				<input type="text" id="carName" class="txt" name="carName" /><br />
				<label>描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述:</label>
				<input type="text" id="carDescribe" class="txt" name="carDescribe" /><br />
				<label style="margin-top: 1px;">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
				<textarea class="txt" id="remark" style="height:70px;" name="remark"></textarea><br />
				<label>录入时间:</label>
				<input type="text" id="ui_timepicker" class="txt" name="applyTime" /><br />
				<input type="button" onclick="start()" value="提交申请" class="txt" style=" font-weight:bold; font-size: calc(15vw/3.75); color: white; height: 40px; margin-left: 15%;margin-top: 25%;background: #33ff99;" /><br />
				<label></label><br />
				<label></label><br />
				<label></label><br />
				<label></label><br />
				<label></label><br />
			</div>
		</form>
	</body>

</html>